package io.renren.modules.lucky.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.lucky.entity.AppSysFeedbackEntity;
import io.renren.modules.lucky.service.AppSysFeedbackService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.lucky.entity.AppSysFeedbackEntity;
import io.renren.modules.lucky.service.AppSysFeedbackService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;

/**
 * app端-系统-反馈信息表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-11-07 22:58:28
 */
@RestController
@RequestMapping("lucky/appsysfeedback")
public class AppSysFeedbackController {
    
    @Autowired
    private AppSysFeedbackService appSysFeedbackService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("lucky:appsysfeedback:list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = appSysFeedbackService.queryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("lucky:appsysfeedback:info")
    public R info(@PathVariable("id") Integer id) {
        AppSysFeedbackEntity appSysFeedback = appSysFeedbackService.getById(id);
        return R.ok().put("appSysFeedback", appSysFeedback);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("lucky:appsysfeedback:save")
    public R save(@RequestBody AppSysFeedbackEntity appSysFeedback) {
        appSysFeedbackService.save(appSysFeedback);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("lucky:appsysfeedback:update")
    public R update(@RequestBody AppSysFeedbackEntity appSysFeedback) {
        appSysFeedbackService.updateById(appSysFeedback);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("lucky:appsysfeedback:delete")
    public R delete(@RequestBody Integer[] ids) {
        appSysFeedbackService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
